/**
 * Licensee: andres orellana
 * License Type: Evaluation
 */
package ormsamples;

import org.orm.*;
public class DeletePinPassData {
	public void deleteTestData() throws PersistentException {
		PersistentTransaction t = orm.PinPassPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.CoordenadaDAO lormCoordenadaDAO = lDAOFactory.getCoordenadaDAO();
			orm.Coordenada lormCoordenada = lormCoordenadaDAO.loadCoordenadaByQuery(null, null);
			// Delete the persistent object
			lormCoordenadaDAO.delete(lormCoordenada);
			orm.dao.LogDAO lormLogDAO = lDAOFactory.getLogDAO();
			orm.Log lormLog = lormLogDAO.loadLogByQuery(null, null);
			// Delete the persistent object
			lormLogDAO.delete(lormLog);
			orm.dao.ClienteDAO lormClienteDAO = lDAOFactory.getClienteDAO();
			orm.Cliente lormCliente = lormClienteDAO.loadClienteByQuery(null, null);
			// Delete the persistent object
			lormClienteDAO.delete(lormCliente);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			DeletePinPassData deletePinPassData = new DeletePinPassData();
			try {
				deletePinPassData.deleteTestData();
			}
			finally {
				orm.PinPassPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
